// companyList.js
var app = getApp()

Page({
  data: {
  },

  onLoad: function (options) {
    var thiz = this
    var PageInterface = app.globalData.domain + app.globalData.PageInterface
    var domain = app.globalData.domain
    wx.getSystemInfo({
      success: function (res) {
        thiz.setData({
          domain: domain,
          hiddenLoading: false,
          windowHeight: res.windowHeight,
          windowWidth: res.windowWidth
        });
      }
    })
    //热马推荐商户
    wx.request({
      url: PageInterface,
      method: 'POST',
      header: { 'content-type': 'application/x-www-form-urlencoded' },
      data: {
        format_type: 'json',
        api_cate: 'Company',
        api: 6001,
        company: 'home',
        limit: 5
      },
      success: function (res) {
        if (res.data.data.length > 0) {
          res.data.data.forEach(function (element, index) {
            element.company_logo = domain + element.company_logo
          })
          thiz.setData({
            companys: res.data.data,
            hiddenLoading: true
          })
        }
      }
    });
  }
})